﻿using ConverterSystems.ServiceModel;
using Opc.Ua.Client;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
namespace ITXHWEB.Models
{

    public class ITXModel: INotifyPropertyChanged
    {
        public ITXModel()
        {
            REMARK = "请扫描";
        }
        public ITXModel(UaSession session)
        {
            REMARK = "请扫描";
            var subscription = new Subscription(session.DefaultSubscription) { PublishingInterval = 250 };
            // Step 5 - Configure the subsscription with all the [MonitoredItem] attributes found in the model
            subscription.WithModel(this).AddBindings();
            // Step 6 - Add the subscription to the session.
            session.AddSubscription(subscription);
        }
        // Step 4 - Create a subscription. Choose faster publishing interval if you wish.
      
        
        [Display(Name = "终端")]
        [StringLength(2)]
        public string TERMNO { get; set; }
 
      
        [Display(Name = "挡车工")]
        [StringLength(8)]
        public string STAFF { get; set; }
        
        [Display(Name = "数据有效")]
        public bool IsDataValid { get; set; }
         
        [Display(Name = "备注")] 
        public string REMARK { get; set; }

        [Display(Name = "WRUNID")]
        public string WRUNID { get; set; }
        [Display(Name = "掌机")]
        public string NEWUSER { get; set; }
        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
        {
            if (!object.Equals(storage, value))
            {
                storage = value;
                var handler = PropertyChanged;
                if (handler != null)
                {
                    handler(this, new PropertyChangedEventArgs(propertyName));
                }
            }
        }
    }
     
}
